package acwing._2LanQiao._4Enumerate;
/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._4Enumerate
 * @File : Q1204.java
 * @Author : WangRuoyu
 * @Date : 2023/3/15 16:52
 */

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Q1204 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");
        int n = Integer.parseInt(words[0]);

        int[] nums = new int[100010];
        int same = 0;
        int p = 0;
        int max = 0;
        int min = 100010;

        for (int i = 0; i < n; ++i) {
            words = br.readLine().split(" ");
            for (int j = 0; j < words.length; ++j) {
                p = Integer.parseInt(words[j]);
                nums[p]++;
                if (nums[p] == 2) {
                    same = p;
                }
                max = Math.max(p, max);
                min = Math.min(p, min);
            }
        }

        for (int i = min; i <= max; ++i) {
            if (nums[i] == 0) {
                System.out.println(i + " " + same);
            }
        }
    }
}
